package com.acheli.rideable.functionLathes.component.compile;

import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.phys.Vec3;
import org.joml.Vector3f;
import java.util.EnumSet;

public class Invoke {
    public static Double vec3length(Vec3 obj) {
        return obj.length();
    }
    // 基础运算
    public static Vec3 vec3add(Vec3 obj, Vec3 num) {
        return obj.add(num);
    }

    public static Vec3 vec3add(Vec3 obj, Double x, Double y, Double z) {
        return obj.add(x, y, z);
    }

    public static Vec3 vec3subtract(Vec3 obj, Vec3 num) {
        return obj.subtract(num);
    }

    public static Vec3 vec3subtract(Vec3 obj, Double x, Double y, Double z) {
        return obj.subtract(x, y, z);
    }

    public static Vec3 vec3multiply(Vec3 obj, Vec3 num) {
        return obj.multiply(num);
    }

    public static Vec3 vec3multiply(Vec3 obj, Double x, Double y, Double z) {
        return obj.multiply(x, y, z);
    }

    public static Vec3 vec3scale(Vec3 obj, Double factor) {
        return obj.scale(factor);
    }

    // 向量运算
    public static Vec3 vec3cross(Vec3 obj, Vec3 other) {
        return obj.cross(other);
    }

    public static Double vec3dot(Vec3 obj, Vec3 other) {
        return obj.dot(other);
    }

    public static Vec3 vec3normalize(Vec3 obj) {
        return obj.normalize();
    }

    // 距离计算
    public static Double vec3distanceTo(Vec3 obj, Vec3 target) {
        return obj.distanceTo(target);
    }

    public static Double vec3distanceToSqr(Vec3 obj, Vec3 target) {
        return obj.distanceToSqr(target);
    }

    // 坐标转换
    public static Vector3f vec3toVector3f(Vec3 obj) {
        return obj.toVector3f();
    }

    // 旋转操作
    public static Vec3 vec3xRot(Vec3 obj, Float degrees) {
        return obj.xRot(degrees);
    }

    public static Vec3 vec3yRot(Vec3 obj, Float degrees) {
        return obj.yRot(degrees);
    }

    public static Vec3 vec3zRot(Vec3 obj, Float degrees) {
        return obj.zRot(degrees);
    }

    // 静态方法封装
    public static Vec3 invokeFromRGB24(Integer packed) {
        return Vec3.fromRGB24(packed);
    }

    public static Vec3 invokeAtLowerCornerOf(Vec3i vec) {
        return Vec3.atLowerCornerOf(vec);
    }

    public static Vec3 invokeAtCenterOf(Vec3i vec) {
        return Vec3.atCenterOf(vec);
    }

    // 其他实用方法
    public static Vec3 vec3lerp(Vec3 from, Vec3 to, Double delta) {
        return from.lerp(to, delta);
    }

    public static Vec3 vec3directionFromRotation(Float pitch, Float yaw) {
        return Vec3.directionFromRotation(pitch, yaw);
    }

    public static Boolean vec3closerThan(Vec3 obj, Vec3 position, Double distance) {
        return obj.closerThan(position, distance);
    }
}